package org.lex.io;

import java.io.InputStream;

public class ConstantsInputStream extends InputStream {
	private byte returnValue = (byte) 127;

	public ConstantsInputStream() {
		this((byte) 127);
	}

	public ConstantsInputStream(byte returnValue) {
		super();
		this.returnValue = returnValue;
	}

	public int available() {
		return Integer.MAX_VALUE;
	}

	public void close() {
	}

	public synchronized void mark(int readlimit) {
		super.mark(readlimit);
	}

	public boolean markSupported() {
		return super.markSupported();
	}

	public int read(byte[] b, int off, int len) {
		for (int i = off; i < len + off; i++)
			b[i] = this.returnValue;
		return len;
	}

	public int read(byte[] b) {
		return this.read(b, 0, b.length);
	}

	public synchronized void reset() {
	}

	public long skip(long n) {
		return n;
	}

	public int read() {
		return this.returnValue;
	}
}
